/*
 * @Author: Drunk 1191047790@qq.com
 * @Date: 2024-11-20 12:14:43
 * @LastEditors: Drunk 1191047790@qq.com
 * @LastEditTime: 2024-11-21 10:49:49
 * @FilePath: \hotel\src\global.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
//定义全局加载的文件
import React from 'react'
import * as UI from 'antd-mobile'
import * as ICON from 'antd-mobile-icons'
import request from '@/services/request'

//React命名空间下创建自定义属性
React.UI = UI
React.ICON = ICON

// 成功和失败提醒方法
React.toast = (msg: string, callback?: any, type?: string) => 
{
    React.UI.Toast.show({
        icon: type ? type : 'success',
        content: msg,
        duration: 1500,
        afterClose: () => 
        {
            if(!callback) return;

            if(typeof callback === "string") callback === "back" ? React.navigate(-1) : React.navigate(callback)
            else callback()
        }
    })
}

export default {}